package treasurer;

import home.HomePage;

import java.io.IOException;
import java.io.Reader;
import java.io.Serializable;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.CheckBox;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.model.IModel;

import com.ibatis.common.resources.Resources;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.ibatis.sqlmap.client.SqlMapClientBuilder;

import controllers.AccountabilityItem;
import controllers.BKSubsidiary;

public class Report extends WebPage {
	
	public Report() throws IOException, SQLException
	{
		Reader reader = Resources.getResourceAsReader("sqlMapConfig.xml");
		SqlMapClient sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
		
		add(new BookmarkablePageLink("home", TreasurerHome.class));
	
		
		Form form = new Form("NotesToFinancialForm");
		
		List<BKSubsidiary> list = (List<BKSubsidiary>)sqlMap.queryForList("BKSubsidiary.getAll");
		
		ListView bk = new ListView("bk", list) {
			private static final long serialVersionUID = 1L;
			
			protected void populateItem(ListItem item) {
				final BKSubsidiary bks = (BKSubsidiary) item.getModelObject();
				
				item.add(new Label("id", Integer.toString(bks.getBks_id())));
				item.add(new Label("assessment", Float.toString(bks.getAssessment())));
				
			}
		};
		form.add(bk);
		add(form);
	}
	
	
}
